buildSchedule{
  Schedule.getSchedule().clear();
  Map<String,Object> map=getApplicationContext().getBeansWithAnnotation(ScriptComponent.class);
  List<Role<? extends AbstractAgent>> roleList=new ArrayList<Role<? extends AbstractAgent>>();
  for (  Object obj : map.values()) {
    Role<? extends AbstractAgent> role=(Role<? extends AbstractAgent>)obj;
    roleList.add(role);
  Map<Role<? extends AbstractAgent>,Integer> roleIndexMap=new HashMap<Role<? extends AbstractAgent>,Integer>();
  for (  Role<? extends AbstractAgent> role : roleList) {
    if (!roleIndexMap.containsKey(role)) {
      roleIndexMap.put(role,findRoleIndex(role,roleList));
  ValueComparator comparator=new ValueComparator(roleIndexMap);
  TreeMap<Role<? extends AbstractAgent>,Integer> sortedIdexMap=new TreeMap(comparator);
  sortedIdexMap.putAll(roleIndexMap);
  for (  Role<? extends AbstractAgent> role : sortedIdexMap.keySet()) {
    ScriptComponent annotation=role.getClass().getAnnotation(ScriptComponent.class);
    String roleName=annotation.name().equals("") ? role.getClass().getSimpleName() : annotation.name();
    Class<? extends AbstractAgent> agentClass=role.agentClass();
    String agentName=agentClass.getSimpleName();
    try {
      if (!agentClass.isInterface()) {
        org.springframework.data.neo4j.support.Neo4jTemplate.findAll
        Collections.shuffle(agents,new Random());
        for (        AbstractAgent agent : agents) {
          Schedule.getSchedule().addRole(roleName,role,agent);
 else {
 catch (    Exception e) {
}
findRoleIndex{
  ScriptComponent annotation=role.getClass().getAnnotation(ScriptComponent.class);
    return 0;
    return roleList.size() - 1;
  if (!annotation.after().equals("")) {
    for (    Role<? extends AbstractAgent> r : roleList) {
      ScriptComponent a=r.getClass().getAnnotation(ScriptComponent.class);
      String afterName=a.name().equals("") ? r.getClass().getSimpleName() : a.name();
      if (afterName.equals(after)) {
        return findRoleIndex(r,roleList) + 1;
  return 0;
}
setApplicationContext{ }
getApplicationContext{ }
getCurrentTick{
  return Schedule.getSchedule().getCurrentTick();
}
listen{
  Schedule.getSchedule().listen(listener);
}
runSimulation{
  this.buildSchedule();
}
stopSimulation{
  Schedule.getSchedule().stop();
}
getState{
  return Schedule.getSchedule().getState();
}
pauseSimulation{
  Schedule.getSchedule().pause();
}
resumeSimulation{
  Schedule.getSchedule().resume();
}
wake{
  Schedule.getSchedule().wake();
}
asList{
  List<T> list;
    list=new ArrayList<T>();
    for (    T t : iterable) {
      list.add(t);
  return list;
}
asCastedList{
  List<E> list=new ArrayList<E>();
    list.add((E)t);
  return list;
}
asDownCastedList{
  List<E> list=new ArrayList<E>();
    list.add((E)t);
  return list;
}
ValueComparator{ }
compare{
  if ((Integer)base.get(a) >= (Integer)base.get(b)) {
    return 1;
}
